package com.jintoufs.weixin.activiti;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jintoufs.dao.QueryFilters;
import com.jintoufs.domain.activiti.Activiti;
import com.jintoufs.service.activiti.ActivitiService;
import com.jintoufs.weixin.SupportAction;
import com.jintoufs.weixin.support.JqgridPage;
import org.cosmos.modules.web.msg.AjaxMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by administrator on 2017/12/25.
 */
@Controller
@Scope("prototype")
@RequestMapping("api/activiti")
public class ActivitiAction extends SupportAction {

    @Autowired
    private ActivitiService activitiService;

    @GetMapping("/list")
    @ResponseBody
    public AjaxMsg list(Integer size,Integer page) {
        AjaxMsg ajaxMsg = new AjaxMsg();
        Map<String,Object> params = new HashMap<>();
        //放入分页
        Integer pageStart = (page - 1) * size;
        params.put("pageStart", pageStart);
        params.put("pageSize", size);
        List<Map<String,Object>> list =  activitiService.selectByParams(params);
        ajaxMsg.setDatas(list);
        return ajaxMsg;
    }
}
